// xc/components/diy/com/cart.js
Component({

  options: {
    addGlobalClass: true,
    multipleSlots: true
  },

  /**
   * 组件的属性列表
   */
  properties: {
    xicocompile: {
      type: Object,
      default: ''
    },
    cartpro: {  //购物车数量
      type: String,
      default: ""      
    },  
    islimit:{  //是不是活动正常活动是有限制的
      type:Boolean,
      default:false,
    },
    htlimit: {   //我的购买数量
      type: Object,
      default: null,
    },
    activecartnum:{  //已加入购物车该产品的总数量
      type:Number,
      default:-1

    },
    totallimit:{  //总数量限制
      type:Number,
      default:-1

    },
    pro: {  //产品数量
      type: Object,
      default: "",
    }
  },
  //carpro
  /**
   * 组件的初始数据
   */
  data: {

  },

ready(){
 

 
 
},

  /**
   * 组件的方法列表
   */
  methods: {

    evnetprevent(ev){


  


    },
    cartop(ev) {
      var app = getApp();
      var platform=app.globalData.platform;
   
      var pro = this.data.pro;
      var app=getApp();
      var that= this;
      app.xc_sys_config.authop.oppower("login").then(function (res) {  
  
        var opmodel={item:pro,op:"add",num:1}
        if(platform=='ios' &&  pro.customdata && pro.customdata.virtualpayment  && pro.customdata.virtualpayment.status==-1 ){
          wx.showModal({
            title: '提示',
            content: pro.customdata.virtualpayment.name?pro.customdata.virtualpayment.name:'ios支付暂不支持',
          })
        }else{
          that.triggerEvent('cartop', opmodel)

        }
      
      })

 

    

 

    

    },
    stepperchange(ev) {
     
      var pro = this.data.pro;

      var opmodel={item:pro,op:"setnum",num: ev.detail}

      this.triggerEvent('cartop', opmodel)
   

    }

  }
})
